//O(nlogMax),n为piles的数量,Max为piles中的最大值
func minEatingSpeed(piles []int, h int) int {
	left, right := 1, 10000000000
	for _, p := range piles {
		if p > right {
			right = p
		}
	} //O(n)
	for left < right {
		mid := left + (right-left)/2
		th := 0
		for _, p := range piles {
			th += (p-1)/mid + 1
		}
		if th <= h {
			right = mid
		} else {
			left = mid + 1
		}
	}
	return left
}
